home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / DVIM72-Mac 1.9.6 / source / MOVE_DOWN_over_to.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-14  |  2.9 KB  |  89 lines  |  [TEXT/R*ch]

  1. /* -*-C-*- movedown.h */
  2. /*-->movedown*/
  3. /**********************************************************************/
  4. /****************************** movedown ******************************/
  5. /**********************************************************************/
  6. #include "dvihead.h"
  7. #include "commands.h"
  8. #include "gendefs.h"
  9. #include "gblprocs.h"
  10. #include "egblvars.h"
  11. #include "m72.h"
  12.  
  13. void
  14. movedown(a)
  15. register INT32 a;
  16.  
  17. {
  18.     /*    From DVITYPE Version 2.6:
  19.     "Vertical motion is done similarly [to horizontal motion handled
  20.     in moveover()],  but with  the threshold  between ``small''  and
  21.     ``large'' increased by  a factor of  five. The idea  is to  make
  22.     fractions  like  ``1/2''  round  consistently,  but  to   absorb
  23.     accumulated rounding errors in the baseline-skip moves."
  24.  
  25.     The one precaution we need to  take here is that fontptr can  be
  26.     NULL, which we treat like  a large movement.  This NULL  pointer
  27.     was used without error  on many different  machines for 2  years
  28.     before it was caught on the VAX VMS implementation, which  makes
  29.     memory page 0 inaccessible.
  30.     */
  31.     vxxxx += a;
  32.     if ((fontptr == (struct font_entry *)NULL) ||
  33.         (ABS(a) >= 5*fontptr->font_space))
  34.     vv = PIXROUND(vxxxx, conv) + tmargin;
  35.     else
  36.     {
  37.     vv += PIXROUND(a, conv);
  38.     vv = fixpos(vv-tmargin,vxxxx,conv) + tmargin;
  39.     }
  40. }
  41.  
  42. /**********************************************************************/
  43. /****************************** moveover ******************************/
  44. /**********************************************************************/
  45. void
  46. moveover(b)
  47. register INT32 b;
  48.  
  49. {
  50.     /*    From DVITYPE Version 2.6:
  51.     "Rounding to the nearest pixel is  best done in the manner shown
  52.     here, so as to  be inoffensive to the  eye: When the  horizontal
  53.     motion is small, like a kern, |hh| changes by rounding the kern;
  54.     but when the motion is large, |hh| changes by rounding the  true
  55.     position |h| so that  accumulated rounding errors disappear.  We
  56.     allow a  larger space  in  the negative  direction than  in  the
  57.     positive one, because TeX  makes comparatively large  backspaces
  58.     when it positions accents."
  59.  
  60.     The one precaution we need to  take here is that fontptr can  be
  61.     NULL, which we treat like  a large movement.  This NULL  pointer
  62.     was used without error  on many different  machines for 2  years
  63.     before it was caught on the VAX VMS implementation, which  makes
  64.     memory page 0 inaccessible.
  65.     */
  66.     hxxxx += b;
  67.     if ((fontptr == (struct font_entry *)NULL) ||
  68.     ABS(b) >= fontptr->font_space)
  69.     hh = PIXROUND(hxxxx, conv) + lmargin;
  70.     else
  71.     {
  72.     hh += PIXROUND(b, conv);
  73.     hh = fixpos(hh-lmargin,hxxxx,conv) + lmargin;
  74.     }
  75. }
  76.  
  77. /**********************************************************************/
  78. /******************************* moveto *******************************/
  79. /**********************************************************************/
  80.  
  81. void
  82. moveto(x,y)
  83. COORDINATE x,y;
  84.  
  85. {
  86.     xcp = x;
  87.     ycp = y;
  88. }
  89.